package com.eagle.roomcrawler.mapper;

import com.eagle.roomcrawler.entity.Url;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * URL管理Mapper
 */
@Mapper
public interface UrlMapper {
    @Select("select * from url")
    public List<Url> findAll();

    @Select("select * from url where url_name = #{urlName}")
    public Url findOne(String urlName);

    @Insert("insert into url(url_name,url_status) values(#{urlName},#{urlStatus})")
    @Options(useGeneratedKeys = true, keyProperty = "urlId")
    public void insert(Url url);

    @Select("update url set url_name = #{urlName},url_status = #{urlStatus} where url_id = #{urlId}")
    public void update(Url url);
}
